home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 April: Penguin on DISC / ADC Developer CD (1993-04) (''Penguin On DISC'')_iso / Dev.CD Apr 93.iso / Utilities / MPW Interfaces 7.1 Beta / PInterfaces / Icons.p < prev    next >
Encoding:
Text File  |  1992-08-28  |  8.2 KB  |  301 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Monday, July 22, 1991 at 7:01 PM
  4.  Icons.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1990-1992
  8.   All rights reserved
  9.  
  10. }
  11.  
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17. {$IFC NOT UsingIncludes}
  18.     UNIT Icons;
  19.     INTERFACE
  20. {$ENDC}
  21.  
  22. {$IFC UNDEFINED UsingIcons}
  23. {$SETC UsingIcons := 1}
  24.  
  25. {$I+}
  26. {$SETC IconsIncludes := UsingIncludes}
  27. {$SETC UsingIncludes := 1}
  28. {$IFC UNDEFINED UsingTypes}
  29. {$I $$Shell(PInterfaces)Types.p}
  30. {$ENDC}
  31. {$IFC UNDEFINED UsingQuickDraw}
  32. {$I $$Shell(PInterfaces)QuickDraw.p}
  33. {$ENDC}
  34. {$SETC UsingIncludes := IconsIncludes}
  35.  
  36.  
  37.  
  38. CONST
  39.  
  40. { The following are icons for which there are both icon suites and SICNs. }
  41. genericDocumentIconResource = -4000;
  42. genericStationeryIconResource = -3985;
  43. genericEditionFileIconResource = -3989;
  44. genericApplicationIconResource = -3996;
  45. genericDeskAccessoryIconResource = -3991;
  46.  
  47. genericFolderIconResource = -3999;
  48. privateFolderIconResource = -3994;
  49.  
  50. floppyIconResource = -3998;
  51. trashIconResource = -3993;
  52.  
  53. { The following are icons for which there are SICNs only. }
  54. desktopIconResource = -3992;
  55. openFolderIconResource = -3997;
  56. genericHardDiskIconResource = -3995;
  57. genericFileServerIconResource = -3972;
  58. genericSuitcaseIconResource = -3970;
  59. genericMoverObjectIconResource = -3969;
  60.  
  61. { The following are icons for which there are icon suites only. }
  62. genericPreferencesIconResource = -3971;
  63. genericQueryDocumentIconResource = -16506;
  64. genericExtensionIconResource = -16415;
  65.  
  66. systemFolderIconResource = -3983;
  67. appleMenuFolderIconResource = -3982;
  68. startupFolderIconResource = -3981;
  69. ownedFolderIconResource = -3980;
  70. dropFolderIconResource = -3979;
  71. sharedFolderIconResource = -3978;
  72. mountedFolderIconResource = -3977;
  73. controlPanelFolderIconResource = -3976;
  74. printMonitorFolderIconResource = -3975;
  75. preferencesFolderIconResource = -3974;
  76. extensionsFolderIconResource = -3973;
  77.  
  78. fullTrashIconResource = -3984;
  79.  
  80. large1BitMask = 'ICN#';
  81. large4BitData = 'icl4';
  82. large8BitData = 'icl8';
  83. small1BitMask = 'ics#';
  84. small4BitData = 'ics4';
  85. small8BitData = 'ics8';
  86. mini1BitMask = 'icm#';
  87. mini4BitData = 'icm4';
  88. mini8BitData = 'icm8';
  89.  
  90.  
  91.     { IconAlignmentType values    }
  92. atNone                =    $0;
  93. atVerticalCenter    =    $1;
  94. atTop                =    $2;
  95. atBottom            =    $3;
  96. atHorizontalCenter    =    $4;
  97. atAbsoluteCenter    =    (atVerticalCenter + atHorizontalCenter);
  98. atCenterTop            =    (atTop + atHorizontalCenter);
  99. atCenterBottom        =    (atBottom + atHorizontalCenter);
  100. atLeft                =    $8;
  101. atCenterLeft        =    (atVerticalCenter + atLeft);
  102. atTopLeft            =    (atTop + atLeft);
  103. atBottomLeft        =    (atBottom + atLeft);
  104. atRight                =    $C;
  105. atCenterRight        =    (atVerticalCenter + atRight);
  106. atTopRight            =    (atTop + atRight);
  107. atBottomRight        =    (atBottom + atRight);
  108.  
  109.     { IconTransformType values }
  110. ttNone                =    $0;
  111. ttDisabled            =    $1;
  112. ttOffline            =    $2;
  113. ttOpen                =    $3;
  114. ttLabel1            =    $0100;
  115. ttLabel2            =    $0200;
  116. ttLabel3            =    $0300;
  117. ttLabel4            =    $0400;
  118. ttLabel5            =    $0500;
  119. ttLabel6            =    $0600;
  120. ttLabel7            =    $0700;
  121. ttSelected            =    $4000;
  122. ttSelectedDisabled    =    (ttSelected + ttDisabled);
  123. ttSelectedOffline    =    (ttSelected + ttOffline);
  124. ttSelectedOpen        =    (ttSelected + ttOpen);
  125.     
  126.     { IconSelectorValue masks }
  127. svLarge1Bit            =    $00000001;
  128. svLarge4Bit            =    $00000002;
  129. svLarge8Bit            =    $00000004;
  130. svSmall1Bit            =    $00000100;
  131. svSmall4Bit            =    $00000200;
  132. svSmall8Bit            =    $00000400;
  133. svMini1Bit            =    $00010000;
  134. svMini4Bit            =    $00020000;
  135. svMini8Bit            =    $00040000;
  136. svAllLargeData        =    $000000ff;
  137. svAllSmallData        =    $0000ff00;
  138. svAllMiniData        =    $00ff0000;
  139. svAll1BitData        =    (svLarge1Bit + svSmall1Bit + svMini1Bit);
  140. svAll4BitData        =    (svLarge4Bit + svSmall4Bit + svMini4Bit);
  141. svAll8BitData        =    (svLarge8Bit + svSmall8Bit + svMini8Bit);
  142. svAllAvailableData    =    $ffffffff;
  143.     
  144. TYPE
  145.     IconSelectorValue    =    LONGINT;
  146.     IconAlignmentType    =    INTEGER;
  147.     IconTransformType    =    INTEGER;
  148.  
  149.     IconAction            =    ProcPtr;    {
  150.                                             FUNCTION IconAction(theType: ResType;
  151.                                                         VAR theIcon: Handle;
  152.                                                         yourDataPtr: Ptr): OSErr;
  153.                                         }
  154.                                         
  155.     IconGetter            =    ProcPtr;    {
  156.                                             FUNCTION IconGetter(theType: ResType;
  157.                                                         yourDataPtr: Ptr): Handle;
  158.                                         }
  159.  
  160.  
  161.     FUNCTION PlotIconID(theRect: Rect;
  162.                         align: IconAlignmentType;
  163.                         transform: IconTransformType;
  164.                         theResID: INTEGER): OSErr;
  165.         INLINE    $303C, $0500, $ABC9;
  166.     
  167.     FUNCTION NewIconSuite(VAR theIconSuite: Handle): OSErr;
  168.         INLINE    $303C, $0207, $ABC9;
  169.     
  170.     FUNCTION AddIconToSuite(theIconData: Handle;
  171.                             theSuite: Handle;
  172.                             theType: ResType): OSErr;
  173.         INLINE    $303C, $0608, $ABC9;
  174.     
  175.     FUNCTION GetIconFromSuite(VAR theIconData: Handle;
  176.                             theSuite: Handle;
  177.                             theType: ResType): OSErr;
  178.         INLINE    $303C, $0609, $ABC9;
  179.     
  180.     FUNCTION ForEachIconDo(theSuite: Handle;
  181.                             selector: IconSelectorValue;
  182.                             action: IconAction;
  183.                             yourDataPtr: Ptr): OSErr;
  184.         INLINE    $303C, $080A, $ABC9;
  185.     
  186.     FUNCTION GetIconSuite(VAR theIconSuite: Handle;
  187.                             theResID: INTEGER;
  188.                             selector: IconSelectorValue): OSErr;
  189.         INLINE    $303C, $0501, $ABC9;
  190.     
  191.     FUNCTION DisposeIconSuite(theIconSuite: Handle;
  192.                             disposeData: BOOLEAN): OSErr;
  193.         INLINE    $303C, $0302, $ABC9;
  194.     
  195.     FUNCTION PlotIconSuite(theRect: Rect;
  196.                             align: IconAlignmentType;
  197.                             transform: IconTransformType;
  198.                             theIconSuite: Handle): OSErr;
  199.         INLINE    $303C, $0603, $ABC9;
  200.     
  201.     FUNCTION MakeIconCache(VAR theHandle: Handle;
  202.                             makeIcon: IconGetter;
  203.                             yourDataPtr: UNIV Ptr): OSErr;
  204.         INLINE    $303C, $0604, $ABC9;
  205.     
  206.     FUNCTION LoadIconCache(theRect: Rect;
  207.                             align: IconAlignmentType;
  208.                             transform: IconTransformType;
  209.                             theIconCache: Handle): OSErr;
  210.         INLINE    $303C, $0606, $ABC9;
  211.  
  212.     FUNCTION PlotIconMethod(theRect: Rect;
  213.                             align: IconAlignmentType;
  214.                             transform: IconTransformType;
  215.                             theMethod: IconGetter;
  216.                             yourDataPtr: UNIV Ptr): OSErr;
  217.         INLINE $303C, $0805, $ABC9;
  218.     
  219.     FUNCTION GetLabel(labelNumber: INTEGER; VAR labelColor: RGBColor;
  220.                             VAR labelString: Str255): OSErr;
  221.         INLINE $303C, $050B, $ABC9;
  222.     
  223.     FUNCTION PtInIconID(testPt: Point; iconRect: Rect;
  224.                     align: IconAlignmentType; iconID: INTEGER): BOOLEAN;
  225.         INLINE $303C, $060D, $ABC9;
  226.  
  227.     FUNCTION PtInIconSuite(testPt: Point; iconRect: Rect;
  228.                     align: IconAlignmentType;
  229.                     theIconSuite: Handle): BOOLEAN;
  230.         INLINE $303C, $070E, $ABC9;
  231.  
  232.     FUNCTION PtInIconMethod(testPt: Point; iconRect: Rect;
  233.                     align: IconAlignmentType;
  234.                     theMethod: IconGetter; yourDataPtr: Ptr): BOOLEAN;
  235.         INLINE $303C, $090F, $ABC9;
  236.  
  237.     FUNCTION RectInIconID(testRect: Rect; iconRect: Rect;
  238.                     align: IconAlignmentType; iconID: INTEGER): BOOLEAN;
  239.         INLINE $303C, $0610, $ABC9;
  240.  
  241.     FUNCTION RectInIconSuite(testRect: Rect; iconRect: Rect;
  242.                     align: IconAlignmentType;
  243.                     theIconSuite: Handle): BOOLEAN;
  244.         INLINE $303C, $0711, $ABC9;
  245.  
  246.     FUNCTION RectInIconMethod(testRect: Rect; iconRect: Rect;
  247.                     align: IconAlignmentType;
  248.                     theMethod: IconGetter; yourDataPtr: Ptr): BOOLEAN;
  249.         INLINE $303C, $0912, $ABC9;
  250.  
  251.     FUNCTION IconIDToRgn(theRgn: RgnHandle; iconRect: Rect;
  252.                     align: IconAlignmentType; iconID: INTEGER): OSErr;
  253.         INLINE $303C, $0613, $ABC9;
  254.  
  255.     FUNCTION IconSuiteToRgn(theRgn: RgnHandle; iconRect: Rect;
  256.                     align: IconAlignmentType;
  257.                     theIconSuite: Handle): OSErr;
  258.         INLINE $303C, $0714, $ABC9;
  259.  
  260.     FUNCTION IconMethodToRgn(theRgn: RgnHandle; iconRect: Rect;
  261.                     align: IconAlignmentType;
  262.                     theMethod: IconGetter; yourDataPtr: Ptr): OSErr;
  263.         INLINE $303C, $0915, $ABC9;
  264.  
  265.     FUNCTION SetSuiteLabel(theSuite: Handle; theLabel: INTEGER): OSErr;
  266.         INLINE $303C, $0316, $ABC9;
  267.  
  268.     FUNCTION GetSuiteLabel(theSuite: Handle): INTEGER;
  269.         INLINE $303C, $0217, $ABC9;
  270.  
  271.     FUNCTION GetIconCacheData(theCache: Handle; VAR theData: Ptr): OSErr;
  272.         INLINE $303C, $0419, $ABC9;
  273.         
  274.     FUNCTION SetIconCacheData(theCache: Handle; theData: Ptr): OSErr;
  275.         INLINE $303C, $041A, $ABC9;
  276.         
  277.     FUNCTION GetIconCacheProc(theCache: Handle; VAR theProc: IconGetter): OSErr;
  278.         INLINE $303C, $041B, $ABC9;
  279.         
  280.     FUNCTION SetIconCacheProc(theCache: Handle; theProc: IconGetter): OSErr;
  281.         INLINE $303C, $041C, $ABC9;
  282.  
  283.     FUNCTION PlotIconHandle(theRect: Rect; align: IconAlignmentType;
  284.                     transform: IconTransformType; theIcon: Handle): OSErr;
  285.         INLINE $303C, $061D, $ABC9;
  286.  
  287.     FUNCTION PlotSICNHandle(theRect: Rect; align: IconAlignmentType;
  288.                     transform: IconTransformType; theSICN: Handle): OSErr;
  289.         INLINE $303C, $061E, $ABC9;
  290.  
  291.     FUNCTION PlotCIconHandle(theRect: Rect; align: IconAlignmentType;
  292.                     transform: IconTransformType; theCIcon: CIconHandle): OSErr;
  293.         INLINE $303C, $061F, $ABC9;
  294.  
  295. {$ENDC} { UsingIcons }
  296.  
  297. {$IFC NOT UsingIncludes}
  298.  END.
  299. {$ENDC}
  300.  
  301.